<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <video 
        src="https://livesec.mudu.tv/watch/nd6p2a.m3u8?auth_key=1565774919-400270-0-1e146f41364de7760a4d5ecd7b34b056"
        controls

        preload="none" 
        x5-video-player-type="h5-page"
        webkit-playsinline="true"
        playsinline="" 
        x-webkit-airplay="allow"
    ></video>
    <div>
        <input type="button" value="开始" id="start">
        <input type="button" value="暂停" id="pause">

    </div>
    <script src="https://cdn.bootcss.com/vConsole/3.3.4/vconsole.min.js"></script>
    <script>
        var vConsole = new VConsole();
  console.log('Hello world');
    </script>
    <script>
        function urlValueToDom () {
            const query = location.search.substr(1)
            const obj = {}


            query.split('&').map(function (pair) {
                const arr = pair.split('=')
                obj[arr[0]] = decodeURIComponent(arr[1])
            })
            return obj
        }
    </script>
    

    <script>
        var video = document.querySelector('video')
        // const query = urlValueToDom()
        // var stream = query.stream
        // if (!stream) {
        //     alert('stream not found')
        // }
        // video.src = stream

        video.addEventListener('error', function () {
            var err = video.error
            var msg = 'video发生错误: code=' + err.code + '; message=' + err.message + '; networkState' + video.networkState
            alert(msg)
        })
        document.getElementById('start').onclick = function () {
            video.play()
        }
        document.getElementById('pause').onclick = function() {
            video.pause()
        }
    </script>
</body>
</html>